
define(['ionic', 'utility'], function () {
    angular.module('U9Mobile.utility')
        .factory('OperaterUtil', ['$q', '$http', 'AppConstants', 
            function ($q, $http, AppConstants) {
                var o = {};

                o.queryDepOperater = function (useCode) {
                    var defer = $q.defer();

                    u9.callSV({
                        name: AppConstants.GET_DEPOPERATER_INFO_CMD,
                        params: [useCode],
                        onSuccess: function (data) {
                            defer.resolve(data);
                        },
                        onFailure: function () {
                            defer.reject();
                        }
                    });

                    return defer.promise;
                };
                o.queryOperaters = function (keyword, isQueryFriend, userId) {
                    var defer = $q.defer();

                    u9.callSV({
                        name: AppConstants.QUERY_OPERATERS_CMD,
                        params: [keyword, isQueryFriend, userId],
                        onSuccess: function (data) {
                            defer.resolve(data);
                        },
                        onFailure: function () {
                            defer.reject();
                        }
                    });

                    return defer.promise;
                };
                o.queryPersonInfo = function () {
                    var defer = $q.defer();

                    u9.callSV({
                        name: AppConstants.GET_PERSON_INFO_CMD,
                        params: [],
                        onSuccess: function (data) {
                            defer.resolve(data);
                        },
                        onFailure: function () {
                            defer.reject();
                        }
                    });

                    return defer.promise;
                };

                return o;
            }
        ]);
});